<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>商品表列表</title>

    <#include "/view/admin/headList.html"/>



    <script type="text/javascript">

        $(function() {
            //初始化

                $('#createTimeStart').datetimepicker({

              	　　language: 'zh-CN',
              	　　autoclose: true,
              	　　todayHighlight: true
              	});
                $('#createTimeEnd').datetimepicker({

              	　　language: 'zh-CN',
              	　　autoclose: true,
              	　　todayHighlight: true
              	});
        });
    </script>
    
    <script>
    	
    function theShelves(){
    	
    	if(window.confirm("您确定上架吗？")){
    		
    		window.location="";
    	}
    	
    }
    
 function offShelves("您确定下架吗？"){
    	
	 window.location="";
    }
    
    
    </script>
</head>
<body>


<div class="table-class ">
    <div class="panel panel-default">
     <div class="panel-body">
       <form class="bs-example bs-example-form" role="form">

                <div class="input-group">
                
                    <span class="input-group-addon">是否下架</span>
                    <select id="soldOut" name="soldOut" class="form-control" >
                       <  <option value="">请选择是否下架</option>
                                    <option value="1" <#if soldOut??&&1 == soldOut>selected="selected"</#if>>是</option>
                                    <option value="0" <#if soldOut??&&0 == soldOut>selected="selected"</#if>>否</option>
                    </select>
                </div>
                <span class="bank-label">&nbsp;</span>


                <div class="input-group">
                    <span class="input-group-addon">商品名称</span>
                    <input type="text" id="commodityName" class="form-control" value="${commodityName!}" name="commodityName" >
                
                </div>
                  <span class="bank-label">&nbsp;</span>
                  <div class="input-group">
                    <span class="input-group-addon">创建时间>=</span>
                  <!--   <input type="text" id="createTimeStart" class="form-control" value="<#if (createtime)?? >${createtime?string('yyyy-MM-dd HH:mm:ss')}</#if>" name="createTimeStart"  data-date-format="yyyy-mm-dd hh:ii:ss"> -->
                	  <input type="text" id="createTimeStart" class="form-control" value="<#if (createTimeStart)?? >${createTimeStart?string('yyyy-MM-dd HH:mm:ss')}</#if>" id="createTimeStart" name="createTimeStart" data-date-format="yyyy-mm-dd hh:ii:ss">
                	
                </div>
                
            <div class="input-group" style="text-align: right;">
                <a class="btn btn-info"  href="javascript:query('${base}/busin/list')"><span class="glyphicon glyphicon-search"></span> 查找</a>


            </div>
        </form>
     </div>
    </div>



    <table class="table table-hover table-list table-bordered">
        <thead>
        
          <tr>
            <td colspan="11" style="background-color: white;">
                <div style="text-align:left;margin-left: 50px;">
                 <@shiro.hasPermission name="13.1.4"> 
                    <a href="${base}/busin/add" class="btn btn-primary btn-sm">新增</a>
                </@shiro.hasPermission>
                </div>
            </td>
        </tr>
        
        <tr class="table-head">
            <th style="width: 30px;">序号</th>
            <th class="label-hidden">主键</th>
            <th>商家</th>
            <th>商品名称</th>
            <th>购买价格</th>
            <th>日租金</th>
            <th>预付租金</th>
            <th>起租天数</th>
            <th>已售量</th>
            <th>是否下架</th>
            <th>创建时间</th>
            <th>排序序号</th>
            <th class="label-hidden">删除标识</th>
            <th style="width: 300px">操作</th>
        </tr>
        </thead>
        <tbody>
        <#list pagination.list as c>
            <tr>
                <td>${(pagination.pageNo-1)*pagination.pageSize+1+c_index}</td>
                        <td class="label-hidden">${c.id!}</td>
                        <td> 
                            <#if c.businessId??>
                                    <#list listBusinessId as lv>
                                        <#if lv.value??&&c.businessId == lv.value >
                                        ${lv.name!}
                                        </#if>
                                    </#list>

                            </#if>
                        </td>
                        <td>${c.commodityName!}</td>
                        <td>${c.presentPrice?default(0)}</td>
                        <td>${c.dailyRent?default(0)}</td>
                        <td>${c.prepaidRent?default(0)}</td>
                        <td>${c.minPrepaidRent?default(0)}</td>
                        <td>${c.soldCount?default(0)}</td>
                        <td>
                            <#if c.soldOut??>
                                 <#if 1==c.soldOut><span class="label label-success">是</span></#if>
                                 <#if 0==c.soldOut><span class="label label-default">否</span></#if>
                            </#if>
                        </td>
                        <td><#if c.createTime?? >${c.createTime?string('yyyy-MM-dd HH:mm:ss')}</#if></td>
                <td>${c.sequence!}</td>
                        <td class="label-hidden">${c.delFlag!}</td>

                <td>
             
                <@shiro.hasPermission name="13.1.2">     
                    <a href="${base}/busin/add.do?id=${c.id!}" class="btn btn-primary btn-sm">修改</a>
                </@shiro.hasPermission>   

				<@shiro.hasPermission name="13.1.1">
                    <a href="${base}/busin/detail.do?id=${c.id!}" class="btn btn-primary btn-sm">预览</a>
                </@shiro.hasPermission>   
                
                 <@shiro.hasPermission name="13.1.5"> 
				<#if c.soldOut ?? &&  c.soldOut==0>
					<a href="javascript:if(confirm('您确定要下架吗?'))location=('${base}/busin/shelves?commodityId=${c.id!}&pageNo=${pagination.pageNo}&pageSize=${pagination.pageSize}&soldOut=1')" class="btn btn-danger btn-sm">下架</a>
					<#else>
						 <a href="javascript:if(confirm('您确定要上架吗?'))location=('${base}/busin/shelves?commodityId=${c.id!}&pageNo=${pagination.pageNo}&pageSize=${pagination.pageSize}&soldOut=0')" class="btn btn-primary btn-sm">上架</a>
				</#if>
				</@shiro.hasPermission>
				
				
        <@shiro.hasPermission name="13.1.3">    
                    <a href="javascript:checkDelete('${base}/busin/delete.do?id=${c.id!}')" class="btn btn-primary btn-sm">删除</a>
                </@shiro.hasPermission>
    
                </td>
            </tr>


        </#list>





        </tbody>
    </table>


</div>
<script>
    function queryCondition(){
        var href = "";
        href+='commodityName='+$('#commodityName').val()+"&";
        href+='content='+$('#content').val()+"&";
        href+='soldOut='+$('#soldOut').val()+"&";
        href+='approveTimeStart='+$('#approveTimeStart').val()+"&";
        href+='approveTimeEnd='+$('#approveTimeEnd').val()+"&";
        href+='createTimeStart='+$('#createTimeStart').val()+"&";
        href+='createTimeEnd='+$('#createTimeEnd').val()+"&";
        href+='createtimeStart='+$('#createtimeStart').val()+'&';
        href+='createtimeEnd='+$('#createtimeEnd').val();

        return href;
    }


    function checkDelete(url){
        if (window.confirm("确认删除吗?")) {
            location.href=url;
        }
    }

</script>

</body>
</html>
